A Java 17 Spring Boot REST API for managing to-do items, with integrated OWASP Dependency-Check for weekly CVE vulnerability scanning of all third-party JARs.
| Tool | Minimum Version | Check |
|---|---|---|
| Java | 17 | java -version |
| Maven | 3.6+ | mvn -version |
| NVD API key | — | Register free |
| jq (optional) | any | brew install jq |
| Trivy (optional) | any | brew install trivy |
mvn spring-boot:run- API base URL:
http://localhost:8080/api/v1/todos - Swagger UI:
http://localhost:8080/swagger-ui.html - H2 Console:
http://localhost:8080/h2-console(JDBC URL:jdbc:h2:mem:tododb, user:sa, no password)
| Method | Path | Description | Status |
|---|---|---|---|
| GET | /api/v1/todos |
List all todos | 200 |
| GET | /api/v1/todos?completed=true |
Filter by completion status | 200 |
| POST | /api/v1/todos |
Create a todo | 201 + Location header |
| GET | /api/v1/todos/{id} |
Get todo by ID | 200 / 404 |
| PUT | /api/v1/todos/{id} |
Update todo | 200 |
| DELETE | /api/v1/todos/{id} |
Delete todo | 204 |
| GET | /api/v1/todos/health |
Health check | 200 |
{
"title": "Buy groceries",
"description": "Milk, eggs, bread",
"completed": false,
"priority": 1
}Priority values: 0 = LOW, 1 = MEDIUM, 2 = HIGH
- Go to: https://nvd.nist.gov/developers/request-an-api-key
- Enter your email and submit
- Click the activation link in the email you receive (arrives within minutes)
- Copy the UUID-format key
# Add to your shell profile for persistence
echo 'export NVD_API_KEY="paste-your-key-here"' >> ~/.zshrc
source ~/.zshrcchmod +x scripts/weekly-scan.sh
./scripts/weekly-scan.shOr directly via Maven:
mvn dependency-check:checkopen target/dependency-check-report/dependency-check-report.htmlThe very first scan downloads the full NVD CVE database. Expected times:
| API Key | Est. Time |
|---|---|
| No key (unauthenticated) | 3–8 hours |
| Free NVD API key | 20–40 minutes |
The database is cached at ~/.owasp/dependency-check-data/. Do not delete this directory between scans — subsequent weekly runs download only delta updates (1–5 minutes).
The report is at target/dependency-check-report/dependency-check-report.html.
| Column | Description |
|---|---|
| Dependency | JAR name and Maven coordinates |
| CVE | CVE ID (click to open NVD entry) |
| Severity | CRITICAL / HIGH / MEDIUM / LOW based on CVSS v3 |
| CVSS v3 Score | 0.0–10.0 scale |
| CWE | Weakness category (e.g. CWE-22 Path Traversal) |
| Fixed Version | Version where this CVE is resolved (when known) |
For each HIGH or CRITICAL finding:
- Note the Fixed Version column
- If a fix version exists, update the dependency in
pom.xml - For BOM-managed versions (Spring Boot manages most), either upgrade the Spring Boot parent version or override via
<properties>, e.g.:<h2.version>2.3.232</h2.version>
- Re-run the scan to confirm the CVE is resolved
Edit suppression.xml to document and suppress findings that do not apply to this deployment:
<suppress until="2026-12-31Z">
<notes>CVE-2022-45868: H2 console JNDI attack vector.
H2 console is disabled in production (spring.h2.console.enabled=false).
Reviewed by: [your name] on [date]</notes>
<packageUrl regex="true">^pkg:maven/com\.h2database/h2@.*$</packageUrl>
<cve>CVE-2022-45868</cve>
</suppress>Always document why the CVE was suppressed and set an expiry date for periodic review.
crontab -eAdd this line (runs every Monday at 02:00):
0 2 * * 1 NVD_API_KEY="your-key" /Users/kalandhar/Documents/KALANDHAR/AI_WORKBENCH_2026/JAVA/JavaCVMScanReport/scripts/weekly-scan.sh >> ~/.owasp/cron-scan.log 2>&1
./scripts/weekly-scan.sh --fail-on-cvss 7./scripts/weekly-scan.sh --trivy# Scan only (no tests)
mvn dependency-check:check
# Scan + tests
mvn verify
# Scan without ever failing the build
mvn dependency-check:check -DfailBuildOnCVSS=11
# Fail build if any HIGH (7.0+) or CRITICAL found
mvn dependency-check:check -DfailBuildOnCVSS=7
# Refresh NVD database without scanning
mvn dependency-check:update-only
# Delete cached NVD database (forces full re-download next run)
mvn dependency-check:purgemvn clean testJavaCVMScanReport/
├── pom.xml # Spring Boot + OWASP Dependency-Check plugin
├── suppression.xml # CVE false-positive suppressions
├── scripts/
│ └── weekly-scan.sh # Weekly scan automation script
└── src/
├── main/java/com/kalandhar/todo/
│ ├── TodoApplication.java
│ ├── controller/TodoController.java
│ ├── service/TodoService.java
│ ├── domain/TodoItem.java
│ ├── repository/TodoRepository.java
│ ├── dto/{TodoRequest,TodoResponse}.java
│ └── exception/{TodoNotFoundException,GlobalExceptionHandler}.java
├── main/resources/application.yml
└── test/java/com/kalandhar/todo/
├── TodoApplicationTests.java
├── controller/TodoControllerTest.java
└── service/TodoServiceTest.java